package Test_1120;

import jdk.swing.interop.SwingInterOpUtils;

import javax.swing.tree.TreeNode;

/**
 * Created with Intellij IDEA
 * Description:
 * User: 星辰
 */
class Node{
    public int value;//数据
    public Node firstChild;//第一个孩子
    public Node nextBrother;//下一个兄弟
}
public class Test {
    public static void main(String[] args) {
        BinaryTree binaryTree=new BinaryTree();
        BinaryTree.TreeNode root=binaryTree.createTree();
        binaryTree.find(root,'E');
    }
    public static void main3(String[] args) {
        BinaryTree binaryTree=new BinaryTree();
        BinaryTree.TreeNode root=binaryTree.createTree();
        BinaryTree.TreeNode root1=new BinaryTree.TreeNode('1');
        BinaryTree.TreeNode root2=new BinaryTree.TreeNode('2');
        BinaryTree.TreeNode root3=new BinaryTree.TreeNode('3');
        root1.left=root2;
        root1.right=root3;
        BinaryTree.TreeNode roo0=new BinaryTree.TreeNode('0');
        BinaryTree.TreeNode roo1=new BinaryTree.TreeNode('1');
        BinaryTree.TreeNode roo2=new BinaryTree.TreeNode('2');
        BinaryTree.TreeNode roo3=new BinaryTree.TreeNode('3');
        roo0.left=roo1;
        roo1.left=roo2;
        roo1.right=roo3;
        binaryTree.isSameTree(roo0,root1);
        binaryTree.isSubtree(roo0,root1);
        binaryTree.isBalanced(root);
    }
    public static void main2(String[] args) {
        BinaryTree binaryTree=new BinaryTree();
        BinaryTree.TreeNode root=binaryTree.createTree();
        binaryTree.size(root);
        binaryTree.size2(root);
        binaryTree.getLeafNodeCount(root);
        System.out.println(binaryTree.getLeafNodeCount2(root));
        binaryTree.getKLevelNodeCount(root,3);
        binaryTree.getHeight(root);
        BinaryTree.TreeNode ret=binaryTree.find(root, 'B');
        System.out.println(ret.val);
    }
    public static void main1(String[] args) {
        BinaryTree binaryTree=new BinaryTree();
        binaryTree.createTree();
        BinaryTree.TreeNode root=binaryTree.createTree();
        binaryTree.preOrder(root);
        System.out.println();
        binaryTree.inOrder(root);
        System.out.println();
        binaryTree.postOrder(root);
    }
}
